<%@ page import="com.jkt.rms.commons.includes.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.jkt.rms.business.*"%>

<%@ include file="/WEB-INF/jsp/include.jsp" %>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="/spring"%>

<html>
<head>
<title><fmt:message key="lbl.title.sysrolePage" /></title>
<script type="text/javascript">
function validateAndSubmit(actiontype)
{
	document.frmMain.action_type.value = actiontype;

	if(frmMain.roleName.value !=0)
	{
		document.frmMain.submit();
		return;
	}
	if(actiontype =='action_submit'){ 
			alert('Please select a Role');
		return;
	}
}
</script>

</head>

 <body><center>
 	<br>
	<div id="headerbar"><fmt:message key="lbl.title.sysrolePage" /></div>
 	<!--  Un comment the following line & comment the 2nd line in real code-->
 	<!-- c:if test="${not empty param.login_error}" -->
 	<c:if test="${ not empty param.login_error}">
		<div id="errorFieldSet">
			<fieldset> 
			  <legend >Errors</legend>
 			</fieldset>
		</div>
	</c:if> 

	<div id="content">
		<div>
			<form:form method="POST" commandName="command"  name="frmMain">
			<input type="hidden" name="action_type">
		  		<fieldset>
				  	<legend ><strong>Select Role </strong></legend>
				    <table border = "0" align="center">
				    	<tr><td align="center">
    						<form:select path="roleName" multiple="false" size="1"  onchange="javascript: validateAndSubmit('action_select');" >
								<form:option   value="0" label="Select"  />
								<form:options items="${command.roles}" itemValue="id" itemLabel="name" />
							</form:select>			
				    	</td></tr>
				    </table>
			   	</fieldset>
			  	
				<fieldset> 
 					<legend>Modules</legend>
				   
				   
 					<table border = "0" align="center">
							<tr><td>
								<form:checkboxes path="moduleSelectedList" items="${command.moduleMap}"  delimiter="<br>" />
							</td></tr>
				    </table>
 				</fieldset>
				
				<table border = "0" align="center">
		    		<tr><td align="center">
						<input type="button"  align="middle" value="Submit"  onclick="javascript: validateAndSubmit('action_submit');">
		    		</td></tr>
		    	</table>
			</form:form>	
		</div>
		<br>			
	</div>
<%@ include file="footer.jsp" %>
</center></body>
</html>
